#coding:utf-8


import tensorflow as tf


a=tf.constant([[1,2,3,4],[5,6,7,8]])

with tf.Session() as sess:
    print(a.eval())
    '''
        argmax 求一个tensor中最大值，0表示按列，1 按行
    '''
    print("argmax over axis 0")
    print(tf.argmax(a,0).eval())
    print("argmax over axis 1")
    print(tf.argmax(a,1))


    print("reduce_sum over entire matrix")
    print(tf.reduce_sum(a).eval())
    print("reduce_sum over over axis 0")
    print(tf.reduce_sum(a,0).eval())

    print("reduce_sum over over axis 1")
    print(tf.reduce_sum(a, 1).eval())

    print("reduce_sum over over axis 1+  keep dimensions")
    print(tf.reduce_sum(a, 1,keep_dims=True).eval())

    print("reduce_sum over over axis 0+  keep dimensions")
    print(tf.reduce_sum(a, 0,keep_dims=True).eval())


    print('Equal to 3')
    print(tf.equal(a,3).eval())

    print('not Equal to 3')
    print(tf.not_equal(a, 3).eval())

    print(tf.random_normal(shape=[3,2],mean=0,stddev=1.0,seed=1).eval())
    print(tf.random_normal(shape=[3,2],mean=0,stddev=1.0,seed=1).eval())